
<!--//详情页面，用来删除单张图片的操作。-->
<?php include_once($_SERVER['DOCUMENT_ROOT']."/controller/common/common_setting_unit.php"); ?>





<?php

$trans_nid  = $_REQUEST ['nid'];
$image      = $_REQUEST ['img'];
$url        = "detail-edit.php?nid=" . $trans_nid . "&sys_part=banner";
$target_img = "alpha.gif";
//获取当前横幅数据，用于删除旧文件
$now_banner = select_one_line_all_items($table_Prefix."detail","nid = '".$_REQUEST ['nid']."'");


$table      = $table_Prefix . "detail";
$sql        = "update $table SET $image = '$target_img' where nid= $trans_nid";

if($image=="attachment")
{
$sql = "update $table SET attachment = '/' where nid= $trans_nid";
}


sql_log($sql);
$query=mysql_query($sql) or die ('数据库操作失败');
mysql_close($con);



//删除这个被删除的文件
$_delete_url=ROOT_PATH_.'/uploadfiles/'.$theme_folder.'/'.$now_banner[$image];
unlink($_delete_url);

?>


<script type="text/javascript">
alert("图片已删除，请继续操作.");
document.location.href = "<? echo $url ?>";
</script>


